package com.gzh.system.model.vo;

import com.gzh.core.model.vo.BaseParam;
import com.gzh.core.util.NumericHelper;
import com.gzh.system.service.dto.RegisterIn;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotNull;

/**
 * @Author guanzh
 * @Date 2022/1/3 20:04
 * @Description
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
public class RegisterParam extends BaseParam {
    //电话
    @NotNull(message = "电话入参不能为空")
    private String tel;
    //邮箱
    private String mail;
    //验证码
    private String verifyCode;
    //密码
    private String password;
    //姓名
    private String fullName;
    //性别
    private String sex;
    //学校
    private String schoolId;

    private String grade;

    private String academyId;

    private String classId;

    private String roleId;

    public RegisterIn paramToIn() {
        RegisterIn in = new RegisterIn();
        in.setMail(this.mail);
        in.setTel(this.tel);
        in.setVerifyCode(this.verifyCode);
        in.setPassword(this.password);
        in.setFullName(this.fullName);
        in.setSex(NumericHelper.toInteger(this.sex));
        in.setSchoolId(NumericHelper.toInteger(this.schoolId));
        in.setGrade(NumericHelper.toInteger(this.grade));
        in.setAcademyId(NumericHelper.toInteger(this.academyId));
        in.setClassId(NumericHelper.toInteger(this.classId));
        in.setRoleId(NumericHelper.toInteger(this.roleId));
        return in;
    }
}
